# LOCAL_PATH is one of libavutil, libavcodec, libavformat, or libswscale

include $(LOCAL_PATH)/../config.mak

FFCFLAGS :=
LOCAL_ARM_MODE := arm
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
    HAVE_ARMVFP := yes
    HAVE_VFP_ARGS := yes
    HAVE_ARMV6 := yes
    HAVE_ARMV6T2 := yes
    FFCFLAGS += -DCMP_HAVE_VFP=1 -DCMP_HAVE_VFP_ARGS=1 -DCMP_HAVE_ARMV6=1 -DCMP_HAVE_ARMV6T2=1 
#    LOCAL_ARM_NEON := true
#    HAVE_NEON := yes
#    FFCFLAGS += -DCMP_HAVE_NEON=1
endif

OBJS :=
OBJS-yes :=
include $(LOCAL_PATH)/Makefile

OBJS += $(OBJS-yes)

FFNAME := lib$(NAME)
FFLIBS := $(foreach,NAME,$(FFLIBS),lib$(NAME))
FFCFLAGS += -DHAVE_AV_CONFIG_H 
FFCFLAGS += -DTARGET_CONFIG=\"config-$(TARGET_ARCH).h\"
#FFCFLAGS += -Wno-sign-compare -Wno-switch -Wno-pointer-sign
#FFCFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC

TARGET_DIR_EXISTS := $(wildcard $(LOCAL_PATH)/$(TARGET_ARCH)/Makefile) 

C_OBJS := $(OBJS)

ifneq ($(strip $(TARGET_DIR_EXISTS)),)
OBJS :=
OBJS-yes :=
include $(LOCAL_PATH)/$(TARGET_ARCH)/Makefile
OBJS += $(OBJS-yes)

ALL_S_FILES := $(wildcard $(LOCAL_PATH)/$(TARGET_ARCH)/*.S)
ALL_S_FILES := $(addprefix $(TARGET_ARCH)/, $(notdir $(ALL_S_FILES)))

ifneq ($(ALL_S_FILES),)
ALL_S_OBJS := $(patsubst %.S,%.o,$(ALL_S_FILES))
C_OBJS += $(filter-out $(ALL_S_OBJS),$(OBJS))
S_OBJS := $(filter $(ALL_S_OBJS),$(OBJS))
else
#C_OBJS := $(OBJS)
S_OBJS :=
endif

else
#C_OBJS := $(OBJS)
S_OBJS :=
endif

C_FILES := $(patsubst %.o,%.c,$(C_OBJS))
S_FILES := $(patsubst %.o,%.S,$(S_OBJS))

FFFILES := $(sort $(S_FILES)) $(sort $(C_FILES))


LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES :=	$(LOCAL_PATH) $(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
#LOCAL_SHARED_LIBRARIES := $(FFLIBS)
